import { useSearchAreaConfig } from '@/components/SearchArea';

export const useSearch = () => {
  const { searchAreaConfig } = useSearchAreaConfig(() => {
    return [
      {
        label: '名称',
        prop: 'username',
        component: 'input',
        placeholder: '请输入名称',
      },
      {
        label: '昵称',
        prop: 'nickname',
        component: 'input',
        placeholder: '请输入昵称',
      },
      {
        label: '性别',
        prop: 'gender',
        component: 'select',
        placeholder: '请选择性别',
        options: [
          { value: '1', label: '男' },
          { value: '2', label: '女' },
        ],
      },
      {
        label: '状态',
        prop: 'status',
        component: 'select',
        placeholder: '请选择状态',
        options: [
          { value: '1', label: '启用' },
          { value: '0', label: '禁用' },
        ],
      },
      {
        label: '电话',
        prop: 'mobile',
        component: 'input',
        placeholder: '请输入电话',
      },
      {
        label: '邮箱',
        prop: 'email',
        component: 'input',
        placeholder: '请输入邮箱',
      },
      {
        label: '创建时间',
        prop: ['createdStartTime', 'createdEndTime'],
        component: 'datePicker',
        type: 'daterange',
        disabledDate: (time: Date) => time > new Date(),
      },
    ];
  });

  return {
    searchAreaConfig,
  };
};
